//
// Created by dwx on 2024/1/21.
//

#ifndef SIMPLEFOC_BSP_BLDCMOTOR_H
#define SIMPLEFOC_BSP_BLDCMOTOR_H
#include "main.h"

typedef  enum {
    CW = 1,
    CCW = -1,
    UNKNOWN = 0,
}Direction;


extern long sensor_direction;
extern float voltage_power_supply;
extern float voltage_limit;
extern float voltage_sensor_align;
extern int  pole_pairs;
extern unsigned long open_loop_timestamp;
extern float velocity_limit;
extern float current_limit;

void Motor_init(void);
void Motor_initFOC(void);
void loopFOC(void);
void move(float new_target);
void setPhaseVoltage(float Uq, float Ud, float angle_el);
#endif //SIMPLEFOC_BSP_BLDCMOTOR_H
